package com.ruicar.afs.cloud.manage.common.controller;

import com.alibaba.fastjson.JSON;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.image.condition.RevolveCondition;
import com.ruicar.afs.cloud.image.condition.UploadCondition;
import com.ruicar.afs.cloud.image.controller.AfsUploadFileController;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Description: </p>
 *
 * @author xudongdong
 * @version 1.0
 * @date create on 2020-07-21 18:54
 * 合同文件操作转换
 */
@Slf4j
@RestController
@RequestMapping("/uploadConvert")
@AllArgsConstructor
public class FileOperationConvertController {
    private final AfsUploadFileController afsUploadFileController;

    @PostMapping(value = "/checkFileConvert")
    @ApiOperation(value = "根据前端参数检查文件是否已上传完整")
    public IResponse checkFileConvert(@RequestBody String val){
        return afsUploadFileController.checkFile(JSON.parseObject(val,UploadCondition.class));
    }

    @PostMapping(value = "/revolveFileConvert")
    @ApiOperation(value = "根据前端参数检查文件是否已上传完整")
    public IResponse revolveFileConvert(@RequestBody String val){
        return afsUploadFileController.revolveFile(JSON.parseObject(val, RevolveCondition.class));
    }

    @PostMapping(value = "/getUploadListByGroupConvert")
    @ApiOperation(value = "根据前端参数检查文件是否已上传完整")
    public IResponse getUploadListByGroupConvert(@RequestBody String val){
        return afsUploadFileController.getUploadListByGroup(JSON.parseObject(val, UploadCondition.class));
    }
}
